#include "../src/parser/sql_parser.h"
#include <stdio.h>
#include <stdlib.h>

int main() {
    printf("Simple Parser Test\n");
    printf("==================\n");
    
    const char* sql = "SELECT name FROM users";
    printf("Creating parser for: %s\n", sql);
    
    parser_t* parser = parser_create(sql);
    if (!parser) {
        printf("Failed to create parser\n");
        return 1;
    }
    
    printf("Parser created successfully\n");
    
    printf("Attempting to parse statement...\n");
    statement_t* stmt = parser_parse_statement(parser);
    
    if (parser_has_error(parser)) {
        printf("Parser error: %s\n", parser_get_error(parser));
    } else if (stmt) {
        printf("Statement parsed successfully\n");
        printf("Statement type: %d\n", stmt->type);
        statement_destroy(stmt);
    } else {
        printf("Failed to parse statement\n");
    }
    
    parser_destroy(parser);
    printf("Test completed\n");
    return 0;
}